package com.vision.sales.customer.cl.ui;

import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.sencha.gxt.data.shared.ListStore;
import com.vision.sales.cm.db.data.AdvancePayment;

/**
 * 
 * @author Mark
 *
 */
public class BoldRowCell<C> extends AbstractCell<C> {
	
	ListStore<AdvancePaymentsTreeNode> store;
	Cell<C> peer;
	
	public BoldRowCell(ListStore<AdvancePaymentsTreeNode> store, Cell<C> peer) {
		this.store = store;
		this.peer = peer;
	}

	@Override
	public void render(com.google.gwt.cell.client.Cell.Context context, C data,
			SafeHtmlBuilder builder) {
		AdvancePaymentsTreeNode model = store.get(context.getIndex());
		if (model.getObject() instanceof AdvancePayment) {
			if (peer != null) {
				peer.render(context, data, builder);
			}
			
			builder.appendHtmlConstant( "<b>" + data + "</b>" );
		}
	}

}
